﻿#ifndef TIANYU_TPL_MGR_H
#define TIANYU_TPL_MGR_H

#include <unordered_map>
#include <string>
#include <set>

#include "../../3rd/libjson/json.h"
#include "common_singleton.h"
#include "activity_config.h"
#include "union_config.h"
#include "teamboss_config.h"
#include "global_config.h"


class CTPLManager : public common::CSingleton< CTPLManager >
{
public:
	CTPLManager();
	~CTPLManager();
	bool LoadTPL(bool reload = false);


	// 限制账号
public:
	bool LoadAccountLimit();
	bool isLimitAccount(uint32_t account);
private:
	Json::Value m_account_limit;
	std::set<uint32_t> m_account_id_set;

	// 公会配置
public:
	bool LoadUnionInfo();
	bool LoadunionBossinfo();
	bool LoadUnionAlcohol();
	bool LoadGlobalConfig();
	const CUnionLvCfg* GetUnionCfgByLevel(int32_t union_level);
	const CUnionAlcohol* GetUnionAlcoholByID(int32_t alcohol_id);
	const CUnionBossCfg& GetUnionBossInfo() { return m_UnionBossCfg; }
	const std::unordered_map<int32_t, CUnionAlcohol>& GetUnionAlcoholMap() { return union_alcohol_map; }
private:
	Json::Value m_union_info;
	std::unordered_map<int32_t, CUnionLvCfg> union_cfg;
	CUnionBossCfg m_UnionBossCfg;
	std::unordered_map< int32_t, CUnionAlcohol> union_alcohol_map;
	//活动配置
public:
	const CActivityConfig& activity_config() { return activity_config_; }
	const CGlobalConfig& global_config() const{ return global_config_; }
private:
	CActivityConfig activity_config_;
	CGlobalConfig global_config_;

public:
	bool LoadTeamBossInfo();
	const CTeamBossCfg& GetTeamBossInfo() { return team_boss_cfg_; }
private:
	CTeamBossCfg team_boss_cfg_;
};

#endif